/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cl.edinet.agencialinea3.ejb.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotNull;

/**
 *
 * @author ivan
 */
@Entity
@Table(name = "PROVISIONES")
@NamedQueries({
    @NamedQuery(name = "Provisiones.findAll", query = "SELECT p FROM Provisiones p"),
    @NamedQuery(name = "Provisiones.findByNumeroDespacho", query = "SELECT p FROM Provisiones p WHERE p.numeroDespacho = :numeroDespacho"),
    @NamedQuery(name = "Provisiones.findByDebe", query = "SELECT p FROM Provisiones p WHERE p.debe = :debe"),
    @NamedQuery(name = "Provisiones.findByHaber", query = "SELECT p FROM Provisiones p WHERE p.haber = :haber"),
    @NamedQuery(name = "Provisiones.findBySaldo", query = "SELECT p FROM Provisiones p WHERE p.saldo = :saldo"),
    @NamedQuery(name = "Provisiones.findByFechaComprobante", query = "SELECT p FROM Provisiones p WHERE p.fechaComprobante = :fechaComprobante")})
public class Provisiones implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "NUMERO_DESPACHO")
    private BigDecimal numeroDespacho;
    @Column(name = "DEBE")
    private BigInteger debe;
    @Column(name = "HABER")
    private BigInteger haber;
    @Column(name = "SALDO")
    private BigInteger saldo;
    @Column(name = "FECHA_COMPROBANTE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaComprobante;
    @JoinColumn(name = "NUMERO_DESPACHO", referencedColumnName = "NUMERO_DESPACHO", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Declaracion declaracion;

    public Provisiones() {
    }

    public Provisiones(BigDecimal numeroDespacho) {
        this.numeroDespacho = numeroDespacho;
    }

    public BigDecimal getNumeroDespacho() {
        return numeroDespacho;
    }

    public void setNumeroDespacho(BigDecimal numeroDespacho) {
        this.numeroDespacho = numeroDespacho;
    }

    public BigInteger getDebe() {
        return debe;
    }

    public void setDebe(BigInteger debe) {
        this.debe = debe;
    }

    public BigInteger getHaber() {
        return haber;
    }

    public void setHaber(BigInteger haber) {
        this.haber = haber;
    }

    public BigInteger getSaldo() {
        return saldo;
    }

    public void setSaldo(BigInteger saldo) {
        this.saldo = saldo;
    }

    public Date getFechaComprobante() {
        return fechaComprobante;
    }

    public void setFechaComprobante(Date fechaComprobante) {
        this.fechaComprobante = fechaComprobante;
    }

    public Declaracion getDeclaracion() {
        return declaracion;
    }

    public void setDeclaracion(Declaracion declaracion) {
        this.declaracion = declaracion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (numeroDespacho != null ? numeroDespacho.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Provisiones)) {
            return false;
        }
        Provisiones other = (Provisiones) object;
        if ((this.numeroDespacho == null && other.numeroDespacho != null) || (this.numeroDespacho != null && !this.numeroDespacho.equals(other.numeroDespacho))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cl.edinet.agencialinea3.ejb.entity.Provisiones[ numeroDespacho=" + numeroDespacho + " ]";
    }
    
}
